; Update documentation of GC in ELisp manual
authorEli Zaretskii <eliz@gnu.org>
Mon, 28 Jul 2025 13:14:44 +0000 (16:14 +0300)
committerEli Zaretskii <eliz@gnu.org>
Mon, 28 Jul 2025 13:14:44 +0000 (16:14 +0300)
* doc/lispref/internals.texi (Garbage Collection): Update default
values for GC-related thresholds.  (Bug#79074)

doc/lispref/internals.texi

index cc82a03db988870e13c3ec64c3487756aef5a61c..939cd489241e48a2758e592f68b4e59d9f32522a 100644 (file)
@@ -555,16 +555,17 @@ object type; space allocated to the contents of buffers does not count.
 
 The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in
 @file{alloc.c}.  Since it's defined in @code{word_size} units, the
-value is 400,000 for the default 32-bit configuration and 800,000 for
-the 64-bit one.  If you specify a larger value, garbage collection
-will happen less often.  This reduces the amount of time spent garbage
-collecting (so Lisp programs will run faster between cycles of garbage
-collection that happen more rarely), but increases total memory use.
-You may want to do this when running a program that creates lots of
-Lisp data, especially if you need it to run faster.  However, we
-recommend against increasing the threshold for prolonged periods of
-time, and advise that you never set it higher than needed for the
-program to run in reasonable time.  Using thresholds higher than
+value is 400,000 for the default 32-bit configuration, and 800,000 for
+the 64-bit one and for 32-bit builds configured with the
+@option{--with-wide-int} option.  If you specify a larger value, garbage
+collection will happen less often.  This reduces the amount of time
+spent garbage collecting (so Lisp programs will run faster between
+cycles of garbage collection that happen more rarely), but increases
+total memory use.  You may want to do this when running a program that
+creates lots of Lisp data, especially if you need it to run faster.
+However, we recommend against increasing the threshold for prolonged
+periods of time, and advise that you never set it higher than needed for
+the program to run in reasonable time.  Using thresholds higher than
 necessary could potentially cause higher system-wide memory pressure,
 and also make each garbage-collection cycle take much more time, and
 should therefore be avoided.
@@ -585,6 +586,10 @@ As the heap size increases, the time to perform a garbage collection
 increases.  Thus, it can be desirable to do them less frequently in
 proportion.
 
+The initial percentage value is 0.1 in interactive sessions and while
+dumping Emacs (@pxref{Building Emacs}), and 1.0 in non-interactive
+(a.k.a.@: ``batch'') sessions.
+
 As with @code{gc-cons-threshold}, do not enlarge this more than
 necessary, and never for prolonged periods of time.
 @end defopt